package com.cskaoyan._05oop2._05inherit;

/**
 * @author Macro_Ray
 * @since 2024/3/13 15:09
 */
/*
 *  1.经理
* 成员变量:工号，姓名，工资，管理奖金
* 成员方法:工作(管理其他人)，吃饭(吃米饭)
    2.厨师
* 成员变量:工号，姓名，工资
* 成员方法:工作(炒菜)，吃饭(吃米饭)*/
public class Demo2 {
    public static void main(String[] args) {
        Manager manager = new Manager("mcr", 001, 15000, 5000);
        System.out.println(manager.getName() + "," + manager.getStaffId() + "," + manager.getSalary() + "," + manager.getBonus());
        manager.work();
        manager.eat();
        System.out.println("-------------");
        Chef chef = new Chef("cyy", 002, 250000);
        System.out.println(chef.getName() + "," + chef.getStaffId() + "," + chef.getSalary());
        chef.work();;
        chef.eat();

    }
}

class Staff {
    private String name; // 姓名
    private int StaffId; // 工号
    private int salary; // 工资

    public Staff() {
    }

    public Staff(String name, int staffId, int salary) {
        this.name = name;
        StaffId = staffId;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getStaffId() {
        return StaffId;
    }

    public void setStaffId(int staffId) {
        StaffId = staffId;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public void work() {
        System.out.println("员工正在工作");
    }

    ;

    public void eat() {
        System.out.println("吃米饭");
    }
}

class Manager extends Staff {
    private int bonus;// 奖金

    // 空参构造
    public Manager() {

    }

    // 全部参数的构造
    // 父类+子类
    public Manager(String name, int staffId, int salary, int bonus) {
        super(name, staffId, salary);
        this.bonus = bonus;
    }

    public int getBonus() {
        return bonus;
    }

    public void setBonus(int bonus) {
        this.bonus = bonus;
    }

    @Override
    public void work() {
        System.out.println("经理会管理其他人");
    }
}

class Chef extends Staff {
    public Chef() {
    }

    public Chef(String name, int staffId, int salary) {
        super(name, staffId, salary);
    }


    @Override
    public void work() {
        System.out.println("厨师炒菜");
    }
}
